﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DotNetFramework.CAP.Core.Ioc
{
    public interface IServiceCollection : IEnumerable<ServiceDescriptor>
    {
        IServiceProvider ServiceProvider { get; set; }

        IServiceCollection AddSingleton<TService>(TService implementationInstance) where TService : class;

        IServiceCollection AddSingleton<TService, TImplementation>()
        where TService : class
        where TImplementation : class, TService;

        void TryAddSingleton<TService, TImplementation>()
        where TService : class
        where TImplementation : class, TService;

        void TryAddSingleton<TService>() where TService : class;

        void TryAddEnumerable(ServiceDescriptor descriptor);

        IServiceCollection AddTransient<TService, TImplementation>();

        IServiceCollection AddScoped(Type serviceType, Type implementationType);

        IServiceCollection AddSingleton(Type serviceType, Type implementationType);

        IServiceCollection AddSingleton<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class;

        IServiceCollection AddSingleton<TService>() where TService : class;

        IServiceCollection AddScoped<TService, TImplementation>();

        IServiceCollection AddInstance<TService>(TService instance) where TService : class;

        IServiceCollection AddScopedMuti<TService, TImplementation>();


        void BeginRegister();

    }


}
